#include <iostream>

using namespace std;

const int MAX=105;
int c[MAX][MAX]={0};

int main()
{
	int n,m;
	cout<<"enter the number of nodes and the number of the lines;";
	cin>>n>>m;

	int u,v;
	for(int i=0;i<m;i++)
	{
		cout<<"enter the connect node"<<endl;
		cin>>u>>v;
		cout<<"enter the weight of the lines"<<endl;
		cin>>c[u][v];
		c[v][u]=c[u][v];
	}

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			cout<<c[i][j];
		}
		cout<<endl;
	}

	system("pause");
	return 0;
}